package postpic.domain.session;

/**
 * Useful for threads which have different SESSIONs
 */
public class UserSessionThreadLocal {
	
	private static final ThreadLocal<UserSession> LOCAL_SESSION = 
		new ThreadLocal<UserSession>();
	
	/**
	 * Method set.
	 * @param session UserSession
	 */
	public static void set(UserSession session) {
		LOCAL_SESSION.set(session);
	}
	
	/**
	 * Method get.
	 * @return UserSession */
	public static UserSession get() {
		return LOCAL_SESSION.get();
	}

	/**
	 * Method setInitialValue.
	 * @return UserSession */
	public static UserSession makeInitialValue() {
		final UserSession session = new UserSession(0, 0);
		LOCAL_SESSION.set(session);
		return session;
	}
	
}
